#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from django import template

register = template.Library()

@register.filter(name='to_sex')
def to_sex(value, arg='zh'):

    """
    性别筛选
    :param value: 0或1
    :param arg: 'zh'或'en'
    :return:
    """

    change = {
        'zh': ('女', '男'),
        'en': ('Female', 'Male'),
    }

    return change[arg][value]

# register.filter('to_sex', to_sex)